<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
        <link rel="stylesheet" href="/css/font.css">
        <link rel="stylesheet" href="/css/xadmin.css">
        <script src="/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/js/xadmin.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">
                    {php}echo config('lang.common.home_tab'){/php}
                </a>
                <a href="">
                    {php}echo config('lang.common.system_tab'){/php}
                </a>
                <a>
                    <cite>
                        {php}echo config('lang.operation_log.tab'){/php}
                    </cite>
                </a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">
                                <div class="layui-inline layui-show-xs-block">
                                    <input name="__token__" type="hidden" class="layui-input" value="{:token()}">
                                    <input class="layui-input"  autocomplete="off" placeholder="{php}echo config('lang.common.start_date'){/php}" name="start_time" id="start">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="{php}echo config('lang.common.end_date'){/php}" name="end_time" id="end">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="account"  placeholder="{php}echo config('lang.common.account'){/php}" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table class="layui-table layui-form">
                                <thead>
                                  <tr>
                                    <th>{php}echo config('lang.common.account'){/php}</th>
                                    <th>{php}echo config('lang.common.operating'){/php}</th>
                                    <th>{php}echo config('lang.common.date'){/php}</th>
                                  </tr>
                                </thead>
                                <tbody id="logList">
                                {php}$systemLog = \app\controller\SystemOperatingLog::read(new \app\model\SystemOperatingLog());{/php}
                                {volist name='systemLog' id='v'}
                                  <tr class="logList">
                                    <td>
                                        {$v.account}
                                    </td>
                                    <td>
                                        {$v.operating}
                                    </td>
                                    <td>
                                        {$v.create_time}
                                    </td>
                                  </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                {$systemLog|raw}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
    </body>
    <script>
      layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
          form.on('submit(search)', function(data){
              getAdminToken();
              $.ajax({
                  type: "POST",
                  url: "/searchOperatingLog",
                  data: data.field,
                  dataType: "json",
                  success: function(data){
                      var logList;
                      $(".logList").remove();
                      $.each(data, function(index, item){
                          logList += '<tr class="logList">';
                          logList += '<td>'+item['account']+'</td>';
                          logList += '<td>'+item['operating']+'</td>';
                          logList += '<td>'+item['create_time']+'</td>';
                          logList += '</tr>';
                          $('#logList').prepend(logList);
                      });
                  }
              });
              return false;
          });
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });


      });
    </script>
</html>